Skip to content

fix: replace TagController.dispose() misuse with closeOverlay() method#41

Merged
shukebeta merged 2 commits into
masterfrom
fix/issue-38-tagcontroller-close-overlay
Jun 16, 2026
Merged

fix: replace TagController.dispose() misuse with closeOverlay() method#41
shukebeta merged 2 commits into
masterfrom
fix/issue-38-tagcontroller-close-overlay

Conversation

@shukebeta

Copy link
Copy Markdown
Owner

Summary

  • Adds closeOverlay() to TagController as the correct API for runtime close operations — timer cancel + overlay remove, callable any number of times
  • dispose() delegates to closeOverlay() and asserts it is only called once (debug-mode guard against future fragility)
  • Updates Listener.onPointerDown in note_edit.dart from dispose() to closeOverlay()
  • Consolidates the duplicate inline close logic in handleTextChanged() to call closeOverlay()

Test plan

  • flutter test test/controllers/tag_controller_test.dart — 3 new tests pass (no-op on empty, idempotent multiple calls, second dispose asserts)
  • flutter analyze — no issues

Closes #38

🤖 Generated with Claude Code

shukebeta and others added 2 commits June 16, 2026 20:35
dispose() was being called on every pointer-down to close the tag overlay,
which would cause a double-dispose exception if TagController ever gains a
field that does not tolerate calling dispose() twice (StreamSubscription,
AnimationController, etc.).

Adds closeOverlay() as the correct API for runtime close operations.
dispose() now calls closeOverlay() internally and asserts it is only
called once. Updates the Listener.onPointerDown handler and the inline
close in handleTextChanged() to use closeOverlay().

Adds TagController unit tests covering the new semantics.

Closes #38

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shukebeta shukebeta merged commit 42ff97d into master Jun 16, 2026
1 check passed
@shukebeta shukebeta deleted the fix/issue-38-tagcontroller-close-overlay branch June 16, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bad smell: TagController.dispose() abused as close-overlay hook in NoteEdit pointer-down handler

1 participant